package com.csj.mvvmtest

import com.csj.mvvm.App
import com.csj.mvvm.api.ApiService
import com.csj.mvvm.api.URLConstant
import com.csj.mvvm.api.retrofit.RetrofitClient
import com.tencent.bugly.crashreport.CrashReport
import org.litepal.LitePal

class BaseApp : App() {
    override fun onCreate() {
        super.onCreate()
        initBugly()
        URLConstant.BASE_URL = getString(R.string.base_url)
        URLConstant.BASE_URL2 = "https://www.xmhigame.com/"
        LitePal.initialize(this)
    }


    /**
     * Bugly
     */
    private fun initBugly() {
        val strategy: CrashReport.UserStrategy = CrashReport.UserStrategy(instance)
        strategy.appChannel = (BuildConfig.BUGLY_CHANNEL) //设置渠道
        strategy.appVersion = (BuildConfig.VERSION_NAME) //App的版本
        strategy.appPackageName = (BuildConfig.APPLICATION_ID) //App的包名
        CrashReport.initCrashReport(
            instance,
            BuildConfig.BUGLY_ID,
            BuildConfig.DEBUG,
            strategy
        )
    }
}